package com.sg.hms.ServiceImpl;

import com.sg.hms.Dao.EmployeeDao;
import com.sg.hms.Dao.XianshiEmployeesDao;
import com.sg.hms.DaoImpl.EmployeeDaoImpl;
import com.sg.hms.DaoImpl.XianshiEmployeesDaoImpl;
import com.sg.hms.Model.Employee;
import com.sg.hms.Service.XianshiEmployeesService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class XianshiEmployeesServiceImpl implements XianshiEmployeesService{
    XianshiEmployeesDao xsempl = new XianshiEmployeesDaoImpl();
	@Override
	public JSONObject xianshiEmployeesSer(int start, int pageSize,int elId) {
		// TODO Auto-generated method stub
		JSONObject empls = new JSONObject();
		empls.put("total", xsempl.employeesCount(elId));
		empls.put("rows", JSONArray.fromObject(xsempl.xianshiEmployees(start, pageSize)));
		return empls;
	}
	@Override
	public JSONObject xianshiEmployeesSer(int start, int pageSize, int elId, String searchName) {
		// TODO Auto-generated method stub
		JSONObject empls = new JSONObject();
		empls.put("total", xsempl.employeesCount(elId,searchName));
		empls.put("rows", JSONArray.fromObject(xsempl.xianshiEmployees(start, pageSize,searchName)));
		return empls;
	}

}
